<template>
    <div>
        <table>
            <tr>
                <td>学号</td>
                <td>姓名</td>
                <td>性别</td>
                <td>专业</td>
                <td>年龄</td>
            </tr>
            <tr v-for="person in persons">
                <td>{{person.sno}}</td>
                <td>{{person.sname}}</td>
                <td>{{person.ssex}}</td>
                <td>{{person.sdept}}</td>
                <td>{{person.sage}}</td>
            </tr>
        </table>
    </div>
</template>

<script>
    export default {
        name: "Person",
        data(){
            return {
                /*伪造后端数据*/
                persons:[
                    {
                        sno:1,
                        sname:'亚古兽',
                        ssex:'female',
                        sdept:'成长期',
                        sage:'6岁半'
                    },
                    {
                        sno: 2,
                        sname:'卡布兽',
                        ssex:'female',
                        sdept:'成长期',
                        sage:'6岁'
                    },
                    {
                        sno:3,
                        sname:'巴达兽',
                        ssex:'male',
                        sdept:'成长期',
                        sage:'3岁半'
                    }
                ]
            }
        },
        created() {
            // alert("????")
            const _this=this
            axios.get("http://localhost:8181/add")
                .then( function (response) {
                    console.log(response.data),
                    _this.persons=response.data
                    }
                )
        }
    }
</script>

<style scoped>

</style>